import { http } from "../http";

const baseUrl = "/api/quota";

export interface QuotaType {
  id?: string | null;
  name: string | null;
  level: number | null;
  evaluationCriteria?: string | null;
  evaluationLevel?: string | null;
  evaluationScore: number | null;
  note?: string | null;
  templateId?: string | null;
  parentQuotaId?: string | null;
}

export interface GetQuotaListQueryType {
  templateId?: string | null;
  name?: string | null;
}

export interface AddOrUpdateQuotaQueryType {
  id?: string | null;
  name: string | null;
  level: number | null;
  evaluationCriteria?: string | null;
  evaluationLevel?: string | null;
  evaluationScore: number | null;
  note?: string | null;
  templateId?: string | null;
  parentQuotaId?: string | null;
}

export interface DeleteQuotaQueryType {
  quotaIds: string[] | null;
}

// 获取指标列表
export const getQuotaListAPI = (params: GetQuotaListQueryType) => {
  return http.post(`${baseUrl}/getQuotaList`, params);
};
// 添加或修改指标
export const addOrUpdateQuotaAPI = (params: AddOrUpdateQuotaQueryType) => {
  return http.post(`${baseUrl}/addOrUpdateQuota`, params);
};
// 删除指标
export const deleteQuotaAPI = (params: DeleteQuotaQueryType) => {
  return http.post(`${baseUrl}/deleteQuota`, params);
};
